import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:jydoctorflutter/routes/routes.dart';
import 'package:jydoctorflutter/routes/routes_pages.dart';
import 'package:jydoctorflutter/utils/tools/loading_dialog.dart';
import 'package:jydoctorflutter/utils/tools/toast_view.dart';
import 'config/app_config.dart';
import 'config/user_data.dart';

Future<void> main() async {
  await AppConfig.init();
  await UserData.loadFromLocal();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        designSize: const Size(375, 812), // 设计尺寸
        builder: (context, widget) {
        return  GetMaterialApp(
            builder: FlutterSmartDialog.init(
              toastBuilder: (msg) => ToastView(msg),
              loadingBuilder: (msg) => const LoadingDialog(),
            ),
            color: Colors.red,
            navigatorObservers: [BotToastNavigatorObserver()],
            title: '家医服务',
            initialRoute: Routes.splashScreenPage,
            getPages: RoutConfig.pages,

          );
        }
    );

  }
}
